package com.javasm.springmybatis.config;

import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//springboot集成mybatis,通过自定义注册器开启驼峰命名

@Configuration
public class MybatisConfig {

@Bean
public ConfigurationCustomizer configurationCustomizer(){
    return new ConfigurationCustomizer() {
        @Override
        public void customize(org.apache.ibatis.session.Configuration configuration) {
            //懒加载
            //configuration.setLazyLoadingEnabled(true);
            //开启驼峰命名
            configuration.setMapUnderscoreToCamelCase(true);
            //设置日志
            //configuration.setLogImpl(Log4jImpl.class);
        }
    };
}

}